<template>
  <div style="height:100%;width:100%;position:relative;" ref="maindev">
    <div class="pagetop">
      <div style="width:100%;">
        <table style="width:100%;font-size:12px;white-space: nowrap;" border="0">
          <col style="width:5%;" />
          <col style="width:20%" />
          <col style="width:5%" />
          <col style="width:10%" />
          <col style="width:5%" />
          <col style="width:9%" />
          <col style="width:5%" />
          <col style="width:8%" />
          <col style="width:5%" />
          <col style="width:8%" />
          <col style="width:5%" />
          <col style="width:15%" />
          <tr>
            <td align="right">
              <el-dropdown @command="handleCommand" style="font-size:12px">
                <u class="el-dropdown-link">
                  {{ datename }}
                </u>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item command="标本日期">
                    <font font-size="12px">标本日期</font>
                  </el-dropdown-item>
                  <el-dropdown-item command="报告日期">
                    <font font-size="12px">报告日期</font>
                  </el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </td>
            <td>
              <table style="border-spacing: 0px;">
                <tr>
                  <td>
                    <el-date-picker v-model="txtstartdate" :clearable="false" type="date" placeholder="选择日期"
                      value-format="yyyy-MM-dd" style="width:100%;">
                    </el-date-picker>
                  </td>
                  <td>至</td>
                  <td>
                    <el-date-picker v-model="txtenddate" type="date" :clearable="false" placeholder="选择日期"
                      value-format="yyyy-MM-dd" style="width:100%;"> </el-date-picker>
                  </td>
                </tr>
              </table>
            </td>
            <td align="right">检验院区</td>
            <td>
              <rm-ddl-common datatype="hospital" dataname="医院" v-model="txtchkhospcode" width="100%"
                @change="chkhospcodeChange"></rm-ddl-common>
            </td>

            <td align="right">检验科室</td>
            <td>
              <el-select v-model="txtchkdeptno"
                @dblclick.native="popMultipleChk(txtchkdeptno, 'txtchkdeptno', labdeptOption, '检验科室选择')" filterable
                clearable>
                <el-option v-for="(item, index) in labdeptOption" :key="index" :value="item.data" :label="item.display">
                </el-option>
              </el-select>
            </td>
            <td align="right">检验组别</td>
            <td>
              <el-select v-model="txtlabgroup"
                @dblclick.native="popMultipleChk(txtlabgroup, 'txtlabgroup', labgroupOption, '请选择检验组别')" filterable
                clearable>
                <el-option v-for="(item, index) in labgroupOption" :key="index" :value="item.data"
                  :label="item.display"></el-option>
              </el-select>
            </td>
            <td align="right">检验医生</td>
            <td>
              <rm-ddl-common datatype="userinfo" kindno="1" dataname="检验医生" v-model="txtchkdoctor" width="100%"
                :readonly="true" @change="chkdoctorChange"></rm-ddl-common>
            </td>
            <td align="right">查询模版</td>
            <td colspan="2">
              <table style="width:100%;border-spacing: 1px;">
                <tr>
                  <td>
                    <el-select v-model="txtquerymod" placeholder="" @change="querymodChange($event)" clearable filterable>
                      <el-option v-for="(item, index) in querymodOption" :key="index" :value="item.value"
                        :label="item.label"></el-option>
                    </el-select>
                  </td>
                  <td>
                    <el-button @click.native="btnSavequerymod" style="background-color:#e6e6e6;color:black">保存</el-button>
                  </td>
                  <td>
                    <el-button @click.native="btnDelquerymod" style="background-color:#e6e6e6;color:black">删除</el-button>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td align="right">报告单元</td>
            <td>
              <el-select v-model="txtrptunit"
                @dblclick.native="popMultipleChk(txtrptunit, 'txtrptunit', rptunitOption, '请选择报告单元')" filterable clearable
                style="width:100%">
                <el-option v-for="(item, index) in rptunitOption" :key="index" :value="item.data"
                  :label="item.display"></el-option>
              </el-select>
            </td>
            <td align="right">送检医院</td>
            <td>
              <el-select v-model="txtsendhospcode"
                @dblclick.native="popMultipleChk(txtsendhospcode, 'txtsendhospcode', hospOption, '请选择送检医院')" filterable
                clearable style="width:100%">
                <el-option v-for="(item, index) in hospOption" :key="index" :value="item.data"
                  :label="item.display"></el-option>
              </el-select>
            </td>
            <td align="right">申请科室</td>
            <td>
              <el-select v-model="txtreqdeptno"
                @dblclick.native="popMultipleChk(txtreqdeptno, 'txtreqdeptno', deptOption, '申请科室选择')" filterable clearable>
                <el-option v-for="(item, index) in deptOption" :key="index" :value="item.data" :label="item.display">
                </el-option>
              </el-select>
            </td>
            <td align="right">申请病区</td>
            <td>
              <el-select v-model="txtwardno" @dblclick.native="popMultipleChk(txtwardno, 'txtwardno', wardOption, '病区选择')"
                filterable clearable>
                <el-option v-for="(item, index) in wardOption" :key="index" :value="item.data" :label="item.display">
                </el-option>
              </el-select>
            </td>

            <td align="right">申请医生</td>
            <td>
              <!-- <el-select v-model="txtsenddoctor" @dblclick.native="popMultipleChk(txtsenddoctor,'txtsenddoctor',doctorOption,'申请医生选择')" filterable clearable>
                              <el-option v-for="(item,index) in doctorOption" :key="index" :value="item.data" :label="item.display">
                              </el-option>
                          </el-select> -->
              <rm-ddl-common datatype="doctor" dataname="医生" v-model="txtsenddoctor" width="100%" :readonly="true"
                @change="senddoctorChange"></rm-ddl-common>
            </td>
            <td align="right">送检原因</td>
            <td colspan="2">
              <el-input v-model="txtchkreason" clearable></el-input>
            </td>
          </tr>
          <tr>
            <td align="right">报告项目</td>
            <td>
              <el-input v-model="txtrptitem" @dblclick.native="dialogTableVisible1 = true" readonly clearable
                placeholder="双击选择报告项目"></el-input>
            </td>
            <td align="right">病人性别</td>
            <td>
              <table style="border-spacing: 1px;">
                <tr>
                  <td>
                    <el-select v-model="txtpatsex" style="width:100%" clearable>
                      <el-option v-for="(item, index)  in sexOption" :key="index" :label="item.label"
                        :value="item.value"></el-option>
                    </el-select>
                  </td>
                  <td align="center">
                    <el-checkbox true-label="1" false-label="0" v-model="txtemerflag">急诊</el-checkbox>
                  </td>
                </tr>
              </table>
            </td>
            <td align="right">病人类型</td>
            <td>
              <el-select v-model="txtpattype"
                @dblclick.native="popMultipleChk(txtpattype, 'txtpattype', pattypeOption, '病人类型选择')" filterable clearable>
                <el-option v-for="(item, index) in pattypeOption" :value="item.data" :label="item.display"
                  :key="index"></el-option>
              </el-select>
            </td>

            <td align="right">病人诊断</td>
            <td>
              <el-input v-model="txtdiagnose" clearable></el-input>
            </td>
            <td align="right">诊断ICD</td>
            <td>
              <el-input v-model="txtdiagnoseicd" clearable></el-input>
            </td>
            <td align="right">医生备注</td>
            <td>
              <el-autocomplete class="inline-input" v-model="txtmemo" :fetch-suggestions="querySearch" placeholder="请输入内容"
                @select="handleSelect" style="width:100%" clearable></el-autocomplete>
              <!-- <el-input v-model="txtmemo" style="width:100%"></el-input> -->
            </td>

          </tr>
          <tr>
            <td align="right">标本号区间</td>
            <td>
              <el-input v-model="sampleno" style="width:100%"></el-input>
            </td>
            <td align="right">所属医院</td>
            <td>
              <rm-ddl-common datatype="hospital" dataname="病人所属医院" v-model="pat_hospcode" width="100"
                @change="pathospitalChange"></rm-ddl-common>
            </td>
            <td align="right">单元组合</td>
            <td>
              <el-select v-model="txtunitgroup"
                @dblclick.native="popMultipleChk(txtunitgroup, 'txtunitgroup', rptunitGroupOption, '单元组合选择')"
                style="width:100%" filterable clearable>
                <el-option v-for="(item, index) in rptunitGroupOption" :key="index" :value="item.data"
                  :label="item.display">
                </el-option>
              </el-select>
            </td>
            <td align="right">费别大类</td>
            <td>
              <rm-ddl-common datatype="chargetype" dataname="收费类别" v-model="txtchargetype" width="100%"
                @change="chargetypeChange"></rm-ddl-common>
            </td>
            <td align="right">时 间 段</td>
            <td colspan="2">
              <table style="border-spacing: 1px;">
                <tr>
                  <td style="width:180px">
                    <el-time-picker v-model="timevalue1" placeholder="开始时间"
                      style="height:25px;line-height:23px;width:80px" value-format="HH:mm"
                      format='HH:mm'></el-time-picker> 至
                    <el-time-picker v-model="timevalue2" placeholder="结束时间"
                      style="height:25px;line-height:23px;width:80px" value-format="HH:mm"
                      format='HH:mm'></el-time-picker>
                  </td>
                  <td align="center">
                    <el-checkbox true-label="1" false-label="0" v-model="txtdelflag">剔除</el-checkbox>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td align="right"><span @click="Btncountitem"
                style="cursor:pointer;font-weight:bold;font-size:14px">统计项目</span></td>
            <td colspan="3">
              <div v-if="infoitem == ''" @click="Btncountitem">
                <span style="color:red;cursor:pointer;font-size:15px">点击该位置选择统计项目</span>
              </div>
              <div v-else>
                <div @click="Btncountitem" style="width:100%;cursor:pointer;color:#409EFF"><u>{{ infoitem }}</u></div>
                <el-input v-model="infocode" readonly v-show="false"></el-input>
              </div>

            </td>
          </tr>
          <tr>
            <td colspan="12" align="left">
              <div class="mychkclass">
                &nbsp;&nbsp;
                混样报告
                <el-select v-model="sel_mixrpt" placeholder="请选择" style="width:110px">
                  <el-option key="0" label="全部报告" value="0"></el-option>
                  <el-option key="1" label="混样主报告" value="1"></el-option>
                  <el-option key="2" label="混样明细报告" value="2"></el-option>
                </el-select>
                <el-checkbox true-label="1" false-label="0" v-model="chk_nopatname"
                  style="margin-left: 5px">无病人姓名</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="chk_noreqno">无申请号</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="chk_notprint">未打印</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="chk_notverify">未审核</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="chk_notchargeitem">非计价项目</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="chk_deptinput">科内录入</el-checkbox>
                <span style="font-weight:bold">的标本不统计</span>
                <span style="font-weight:bold">&nbsp;&nbsp; <el-divider
                    direction="vertical"></el-divider>&nbsp;&nbsp;统计包含&nbsp;&nbsp; </span>
                <el-checkbox true-label="1" false-label="0" v-model="chk_workdays">工作日</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="chk_holiday">节假日</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="chk_saturday">周六</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="chk_sunday">周日</el-checkbox>
                &nbsp;&nbsp; <el-divider direction="vertical"></el-divider>&nbsp;&nbsp;
                <el-checkbox true-label="1" false-label="0" v-model="chk_nobarcode">仅统计无条码</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="chk_pricemorezero">仅显示项目价格大于0</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="showsum2">显示小计</el-checkbox>
                <el-checkbox true-label="1" false-label="0" v-model="showsum1">显示合计</el-checkbox>
              </div>
            </td>
          </tr>
        </table>
        <div class="operation-list">
          <el-button @click.native="BtnQuery" v-has="'PINQUERY'" type="primary" icon="el-icon-search">查询</el-button>
          <el-button @click.native="BtnSort" icon="el-icon-sort">排序</el-button>
          <el-button @click.native="BtnClear" icon="el-icon-close">清除</el-button>
          <el-button @click.native="BtnExport" icon="el-icon-upload2">导出</el-button>
          <el-button @click.native="BtnPrint(1)" v-has="'PPRINT'" icon="el-icon-printer">打印</el-button>
          <el-button @click.native="BtnPrint(3)" v-if="$tool.getSession(this.$tool.loginuserno) == 'admin'"
            icon="el-icon-printer">样式调整</el-button>
        </div>
      </div>
    </div>
    <div class="pagecenter">
      <div class="middle-center">
        <vxe-table :data.sync="tableData" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" border
          height="auto" highlight-current-row class="mytable-style" highlight-hover-column highlight-hover-row
          how-header-overflow ref="xTable" resizable show-overflow size="mini" stripe show-header-overflow
          :optimization="{ animat: false }" header-align="center" :key="xTablekey" show-footer :footer-method="footerMethod"
          :footer-cell-class-name="footerCellClassName" :cell-class-name="CellClassName" :loading="xTableLoading">
          <vxe-table-column :field="items.field" :key="items.field" :title="items.title"
            :width="items.field == 'pat_sex' ? 40 : items.width" sortable v-for="items in tableColumn"
            :align="items.field == 'pat_sex' ? 'center' : ''">
          </vxe-table-column>
          <vxe-table-column field="cp_cnt" sortable title="检验项目次数" width="100" show-overflow header-align="center"
            align="right"></vxe-table-column>
          <vxe-table-column field="cp_amt" sortable title="金额" width="80" show-overflow header-align="center"
            align="right"></vxe-table-column>
          <vxe-table-column field="cp_rs" sortable title="人数" width="80" header-align="center" v-if="chk_personnum == '1'"
            align="right"></vxe-table-column>
          <vxe-table-column field="cp_samplecnt" sortable title="报告数" width="80" v-if="chk_reportnum == '1'"
            align="right"></vxe-table-column>
          <vxe-table-column field="cp_redocnt" sortable title="项目复查数" width="90" show-overflow
            v-if="chk_itemrechknum == '1'" align="right"></vxe-table-column>
        </vxe-table>
      </div>
    </div>
    <!--统计项目-->
    <el-dialog title="统计项目" :visible.sync="dialogcountItem" width="970px" v-el-drag-dialog :append-to-body="true"
      :close-on-click-modal="false">
      <div style="width:100%;height:40px;">
        <div style="width:53%;float:left">
          <table class="table1style">
            <tr>
              <td>统计模版</td>
              <td>
                <el-select v-model="txtstasticsmod" placeholder="" @change="stasticmodChange($event)" clearable
                  @clear="resetStasticItem()">
                  <el-option v-for="(item, index) in stasticsmodOption" :key="index" :value="item.value"
                    :label="item.label"></el-option>
                </el-select>
              </td>
              <td>
                <el-button @click.native="btnSaveStaticmod">保存模版</el-button>
                <el-button @click.native="btnDelStaticmod">删除模版</el-button>
              </td>
            </tr>

          </table>
        </div>
        <div style="width:47%;float:left;padding-top:2px;position:absolute;right:0px">
          <el-button icon="el-icon-top" @click.native="tabledatafirst()">首位</el-button>
          <el-button icon="el-icon-top-right" @click.native="tabledataup()">上移</el-button>
          <el-button icon="el-icon-bottom-right" @click.native="tabledatadown()">下移</el-button>
          <el-button icon="el-icon-bottom" @click.native="tabledatalast()">末位</el-button>
          <el-button icon="el-icon-close" @click.native="resetStasticItem()">清除</el-button>
        </div>
      </div>
      <div style="width:99.5%;height:34px;border:1px solid #ccc;padding:5px;">
        <table>
          <tr>
            <td>其他统计项</td>
            <td colspan="3" align="right">
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <el-checkbox true-label="1" false-label="0" v-model="chk_personnum">人数</el-checkbox>
              <el-checkbox true-label="1" false-label="0" v-model="chk_reportnum">报告数</el-checkbox>
              <el-checkbox true-label="1" false-label="0" v-model="chk_itemrechknum">项目复查数</el-checkbox>
            </td>
          </tr>
        </table>
      </div>
      <div style="width:100%;height:300px;margin-top:5px">
        <div style="width:70%;height:100%;float:left;overflow:auto;border:1px solid #ccc;">
          <div id='left_nav' class="left_nav">
            <div @click="showseq = 1" :class="showseq == 1 ? 'active' : ''" ref="left1">
              1 送检信息
            </div>
            <div @click="showseq = 2" :class="showseq == 2 ? 'active' : ''" ref="left2">
              2 检验信息
            </div>
            <div @click="showseq = 3" :class="showseq == 3 ? 'active' : ''" ref="left3">
              3 病人信息
            </div>
            <div @click="showseq = 4" :class="showseq == 4 ? 'active' : ''" ref="left4">
              4 项目信息
            </div>
            <div @click="showseq = 5" :class="showseq == 5 ? 'active' : ''" ref="left5">
              5 检验日期
            </div>
          </div>
          <div id='right_nav' class="right_nav">
            <table class="table1style" style="width:100%;padding:10px">
              <tr v-show="showseq == 1">
                <td>
                  <el-checkbox @change="chkcountitem($event, '送检医院代码', 'chksendhospcode')"
                    v-model="chksendhospcode">送检医院代码</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '送检医院名称', 'chksendhospitalname')"
                    v-model="chksendhospitalname">送检医院名称</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '送检医院简称', 'chksendhospitalna')"
                    v-model="chksendhospitalna">送检医院简称</el-checkbox>
                </td>

              </tr>
              <tr v-show="showseq == 1">
                <td>
                  <el-checkbox @change="chkcountitem($event, '送检科室', 'chksenddeptno')"
                    v-model="chksenddeptno">送检科室</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '送检目的', 'chksendreason')"
                    v-model="chksendreason">送检目的</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '送检医生', 'chksenddoctor')" v-model="chksenddoctor"
                    v-has="'PQREQDOC'">送检医生</el-checkbox>
                </td>
              </tr>
              <tr v-show="showseq == 2">
                <td>
                  <el-checkbox @change="chkcountitem($event, '检验医生', 'chkexamdoctor')"
                    v-model="chkexamdoctor">检验医生</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '检验院区', 'chkexamhospcode')"
                    v-model="chkexamhospcode">检验院区</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '审核医生', 'chkverifydoctor')"
                    v-model="chkverifydoctor">审核医生</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '检验科室', 'chkexamdeptno')"
                    v-model="chkexamdeptno">检验科室</el-checkbox>
                </td>
              </tr>
              <tr v-show="showseq == 2">
                <td>
                  <el-checkbox @change="chkcountitem($event, '检验组别', 'chkexamgroup')"
                    v-model="chkexamgroup">检验组别</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '报告单元', 'chkexamtptunit')"
                    v-model="chkexamtptunit">报告单元</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '仪器', 'chkexaminstrument')"
                    v-model="chkexaminstrument">仪器</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '检验备注', 'chkexammemo')"
                    v-model="chkexammemo">检验备注</el-checkbox>
                </td>
              </tr>
              <tr v-show="showseq == 3">
                <td>
                  <el-checkbox @change="chkcountitem($event, '病区', 'chkpatwardno')" v-model="chkpatwardno">病区</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '病人', 'chkpatname')" v-model="chkpatname">病人</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '诊断', 'chkpatdianose')"
                    v-model="chkpatdianose">诊断</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '诊断ICD', 'chkpatdianoseicd')"
                    v-model="chkpatdianoseicd">诊断ICD</el-checkbox>
                </td>
              </tr>
              <tr v-show="showseq == 3">
                <td>
                  <el-checkbox @change="chkcountitem($event, '性别', 'chkpatsex')" v-model="chkpatsex">性别</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '病人类型', 'chkpattype')" v-model="chkpattype">病人类型</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '费别大类', 'chkpatchargetype')"
                    v-model="chkpatchargetype">费别大类</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '费别', 'chkpatchargeno')"
                    v-model="chkpatchargeno">费别</el-checkbox>
                </td>
              </tr>
              <tr v-show="showseq == 3">
                <td>
                  <el-checkbox @change="chkcountitem($event, '国籍名称(体检单位)', 'chkpatnation')"
                    v-model="chkpatnation">国籍名称(体检单位)</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '病人所属医院', 'chkpatOfhospcode')"
                    v-model="chkpatOfhospcode">病人所属医院</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '病人号', 'chkpatno')" v-model="chkpatno">病人号</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '身份证号', 'chkidcardno')"
                    v-model="chkidcardno">身份证号</el-checkbox>
                </td>
              </tr>
              <tr v-show="showseq == 3">
                <td>
                  <el-checkbox @change="chkcountitem($event, '床位', 'chkbedno')" v-model="chkbedno">床位</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '民族', 'chkpat_nationna')"
                    v-model="chkpat_nationna">民族</el-checkbox>
                </td>
              </tr>
              <tr v-show="showseq == 4">
                <td>
                  <el-checkbox @change="chkcountitem($event, '标本类型', 'chkitemspecimen')"
                    v-model="chkitemspecimen">标本类型</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '计价', 'chkitemchargeflag')"
                    v-model="chkitemchargeflag">计价</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '项目代码', 'chkitemcode')"
                    v-model="chkitemcode">项目代码</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '项目名称', 'chkitemname')"
                    v-model="chkitemname">项目名称</el-checkbox>
                </td>
              </tr>
              <tr v-show="showseq == 4">
                <td>
                  <el-checkbox @change="chkcountitem($event, '单价', 'chkitemprice')" v-model="chkitemprice">单价</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '统计代码', 'chkitemstatisticcode')"
                    v-model="chkitemstatisticcode">统计代码</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '采样人', 'chksampleuser')"
                    v-model="chksampleuser">采样人</el-checkbox>
                </td>
              </tr>
              <tr v-show="showseq == 5">
                <td>
                  <el-checkbox @change="chkcountitem($event, '年', 'chkdateyear')" v-model="chkdateyear">年</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '月', 'chkdatemonth')" v-model="chkdatemonth">月</el-checkbox>
                </td>
                <td>
                  <el-checkbox @change="chkcountitem($event, '日', 'chkdateday')" v-model="chkdateday">日</el-checkbox>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div style="width:29%;height:100%;float:left;margin-left:5px;overflow:auto;">
          <vxe-table show-overflow ref="xTable1" height="auto" :select-config="{ reserve: true }"
            :sort-config="{ trigger: 'cell' }" :mouse-config="{ selected: true }" :data.sync="staticitemData" border
            size="mini" show-header-overflow highlight-current-row highlight-hover-row resizable stripe
            @current-change="currentChangeEvent1" @cell-dblclick="xTable1dblclick">
            <vxe-table-column type="index" title="NO." width="50" header-align="center" align='center'></vxe-table-column>
            <vxe-table-column field="countitem" title="统计项目(双击删除)" width="160" sortable
              header-align="center"></vxe-table-column>
          </vxe-table>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogcountItemsave">确 定</el-button>
        <el-button @click="dialogcountItem = false">取 消</el-button>
      </span>
    </el-dialog>
    <!--报告项目--->
    <el-dialog width="1000px" top="10px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false"
      title="报告项目" :visible.sync="dialogTableVisible1" :destroy-on-close="true">
      <rm-pop-selrptitem @cancel="dialogTableVisible1 = false;" @selitem="addrptitem"
        :rptUnitIds="txtrptunit"></rm-pop-selrptitem>
    </el-dialog>

    <!--多选弹窗--->
    <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="multichktitle"
      :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
      <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname"
        @change="closedialog"></rm-SqlMultiple>
    </el-dialog>
  </div>
</template>

<script type="text/javascript">
import XEUtils from "xe-utils";
export default {
  name: "LIS610",
  data() {
    return {
      sexOption: [
        { label: "", value: "" },
        { label: "男", value: "1" },
        { label: "女", value: "2" },
      ],
      chargeflagOption: [
        { label: "未收费", value: "0" },
        { label: "已收费", value: "1" },
        { label: "等待退费", value: "8" },
        { label: "已退费", value: "9" },
        { label: "免费", value: "5" },
      ],
      is_showselother: false,
      dialogcountItem: false,
      dialogTableVisible1: false,
      dialogMultipleVisible: false,
      xTableLoading: false,
      option1: [],
      option2: [],
      fieldname: "",
      tableColumn: [],
      tableData: [],
      staticitemData: [],
      showseq: 1,
      currRowIndex: 0,
      xTablekey: 0,
      datename: "标本日期",
      multichktitle: "",
      datecode: "sam",
      txtstasticsmod: "", //弹窗统计模版
      stasticsmodOption: [], //统计模版列表
      txtquerymod: "", //查询模版
      querymodOption: [], //查询模版列表
      pattypeOption: [],
      deptOption: [],
      labdeptOption: [],
      wardOption: [],
      hospOption: [],
      doctorOption: [],
      rptunitOption: [],
      rptunitGroupOption: [],
      reportcommOption: [],
      labgroupOption: [],
      instrOption: [],
      //以下为查询条件
      sampleno: "",
      txtstartdate: "",
      txtenddate: "",
      txtchkhospcode: "",
      txtchkdeptno: "",
      txtlabgroup: "",
      txtchkdoctor: "",
      txtpattype: "",
      txtemerflag: "0",
      txtrptunit: "",
      txtsendhospcode: "",
      txtreqdeptno: "",
      txtunitgroup: "",
      txtsenddoctor: "",
      txtpatsex: "",
      txtdelflag: "0",
      txtmemo: "",
      infoitem: "", //"项目代码,项目名称", //送检医院
      infocode: "", //"chkitemcode,chkitemname", //chksendhospcode
      txtrptitem: "",
      txtchkreason: "",
      txtdiagnose: "",
      txtdiagnoseicd: "",
      txtchargetype: "",
      timevalue1: "00:00",
      timevalue2: "23:59",
      txtwardno: "",
      pat_hospcode: "", //病人所属医院
      sel_mixrpt: "0", //混样报告
      chk_nopatname: "1",
      chk_noreqno: "0",
      chk_notprint: "0",
      chk_notverify: "1",
      chk_notchargeitem: "1",
      chk_deptinput: "0",
      chk_pricemorezero: "0",
      chk_nobarcode: "0",
      chk_sunday: "1",
      chk_saturday: "1",
      chk_holiday: "1",
      chk_workdays: "1",
      chk_personnum: "0",
      chk_reportnum: "0",
      chk_itemrechknum: "0",
      chk_notshowcount: "0",
      showsum2: "0",
      showsum1: "0",
      //以下为统计项目
      chksendhospcode: false,
      chksendhospitalname: false,
      chksendhospitalna: false,
      chksenddeptno: false,
      chksenddoctor: false,
      chksendreason: false,
      chkexamdoctor: false,
      chkexamhospcode: false,
      chkverifydoctor: false,
      chkexamdeptno: false,
      chkexamgroup: false,
      chkexamtptunit: false,
      chkexaminstrument: false,
      chkexammemo: false,
      chkpatwardno: false,
      chkpatname: false,
      chkpatdianose: false,
      chkpatdianoseicd: false,
      chkpatsex: false,
      chkpattype: false,
      chkpatchargetype: false,
      chkpatchargeno: false,
      chkpatnation: false,
      chkitemspecimen: false,
      chkitemchargeflag: false,
      chkitemcode: false,
      chkitemname: false,
      chkitemprice: false,
      chkitemstatisticcode: false,
      chkdateyear: false,
      chkdatemonth: false,
      chkdateday: false,
      chkpatOfhospcode: false,
      chkpatno: false, //病人号
      chkbedno: false, //床位
      chkpat_nationna: false, //民族
      chkidcardno: false, //身份证号
      chksampleuser: false, //采样人
      //以下为排序数组
      sortArr: [],
      SortTableColumn: [
        { title: "报告数", field: "cp_samplecnt" },
        { title: "检验项目次数", field: "cp_cnt" },
        { title: "金额", field: "cp_amt" },
        { title: "人数", field: "cp_rs" },
        { title: "项目复查数", field: "cp_redocnt" },
      ],
      exportTableColumn: [],
      // 导出统计条件用
      txtchkhospname: "",
      txtchkdoctorname: "",
      txtsenddoctorname: "",
      pat_hospname: "",
      txtchargetypename: "",
      txtrptitemname: "",
    };
  },
  created() {
    this.initOption();
    this.initdate(); //初始化时间
    //this.InitPage(); //初始化主列表
  },
  mounted() {
    this.querymodOption = [];
    let modOption1 = localStorage.getItem("rm_Qmod_LIS610");
    let modOptions1 = JSON.parse(modOption1);
    if (modOptions1 != null) {
      this.querymodOption = XEUtils.clone(modOptions1, true);
    }

    this.stasticsmodOption = [];
    let modOption2 = localStorage.getItem("rm_Smod_LIS610");
    let modOptions2 = JSON.parse(modOption2);
    if (modOptions2 != null) {
      this.stasticsmodOption = XEUtils.clone(modOptions2, true);
    }
  },
  updated() { },
  methods: {
    popMultipleChk(e, fieldname, option, title) {
      let temp = XEUtils.clone(option, true);
      this.option1 = [];
      this.option2 = [];
      if (e != "") {
        let k = e.split(",");
        k.forEach((item) => {
          let ndata = temp.find((m) => m.data == item);
          if (ndata != undefined && ndata != null) {
            this.option2.push(ndata);
          }
        });
        temp.forEach((item) => {
          if (k.indexOf(item.data + "") < 0) {
            this.option1.push(item);
          }
        });
      } else {
        this.option1 = temp;
      }
      this.fieldname = fieldname;
      this.multichktitle = title;
      this.dialogMultipleVisible = true;
    },
    closedialog(value, name) {
      if (value != "close") {
        this[name] = value;
      }
      this.dialogMultipleVisible = false;
    },
    //时间初始化
    initdate() {
      // var day1 = new Date();
      // day1.setTime(day1.getTime());
      // var s1 = day1.getFullYear() + "-" + (day1.getMonth() + 1) + "-" + day1.getDate() + " 23:59:59";
      // var day2 = new Date();
      // day2.setTime(day2.getTime());
      // var s2 = day2.getFullYear() + "-" + (day2.getMonth() + 1) + "-" + day2.getDate() + " 00:00:00";
      this.txtstartdate = this.$pub.InitDateTime();
      this.txtenddate = this.$pub.InitDateTime();
    },
    addrptitem(rptitemcodeinfos) {
      this.txtrptitem = "";
      this.txtrptitemname = "";
      for (var i = 0; i < rptitemcodeinfos.length; i++) {
        if (this.txtrptitem == "") {
          this.txtrptitem = rptitemcodeinfos[i].rpt_itemcode;
        } else {
          this.txtrptitem += "," + rptitemcodeinfos[i].rpt_itemcode;
        }
        if (this.txtrptitemname == "") {
          this.txtrptitemname = rptitemcodeinfos[i].rpt_itemname;
        } else {
          this.txtrptitemname += "," + rptitemcodeinfos[i].rpt_itemname;
        }
      }
      this.dialogTableVisible1 = false;
    },
    //弹出统计项目
    Btncountitem() {
      //重置所有选项
      this.resetStasticItem();
      this.txtstasticsmod = "";
      this.dialogcountItem = true; //开窗
      //表格及checkbox重新赋值
      setTimeout(() => {
        this.$refs.xTable1.tableData = [];
        if (this.infoitem != "") {
          let name = this.infoitem.split(",");
          let code = this.infocode.split(",");
          let datas = this.$refs.xTable1.tableData;
          for (let i = 0; i < name.length; i++) {
            let finddatas = datas.filter((item) => item.countitem == name[i]);
            if (finddatas.length == 0) {
              this.$refs.xTable1.insert({ countitem: name[i], countcode: code[i] }).then(({ row }) => {
                this.$refs.xTable1.setCurrentRow(row);
              });
              this.currRowIndex = name.length - 1;
            }
            this[code[i]] = true;
          }
        }
      }, 20);
    },
    //重置统计项目
    resetStasticItem() {
      this.chksendhospcode = false;
      this.chksendhospitalname = false;
      this.chksendhospitalna = false;
      this.chksenddeptno = false;
      this.chksenddoctor = false;
      this.chksendreason = false;
      this.chkexamdoctor = false;
      this.chkexamhospcode = false;
      this.chkverifydoctor = false;
      this.chkexamdeptno = false;
      this.chkexamgroup = false;
      this.chkexamtptunit = false;
      this.chkexaminstrument = false;
      this.chkexammemo = false;
      this.chkpatwardno = false;
      this.chkpatname = false;
      this.chkpatdianose = false;
      this.chkpatdianoseicd = false;
      this.chkpatsex = false;
      this.chkpattype = false;
      this.chkpatchargetype = false;
      this.chkpatchargeno = false;
      this.chkpatnation = false;
      this.chkitemspecimen = false;
      this.chkitemchargeflag = false;
      this.chkitemcode = false;
      this.chkitemname = false;
      this.chkitemprice = false;
      this.chkitemstatisticcode = false;
      this.chkdateyear = false;
      this.chkdatemonth = false;
      this.chkdateday = false;
      this.chkpatOfhospcode = false;
      this.chkpatno = false;
      this.chkbedno = false;
      this.chkpat_nationna = false;
      this.chkidcardno = false;
      this.chksampleuser = false;
      this.staticitemData = [];
    },
    //选择统计项目
    chkcountitem(e, name, code) {
      let tablelist = this.$refs.xTable1.tableData;
      let ishave = tablelist.find((m) => m.countitem == name);
      if (e) {
        if (tablelist.length <= 9) {
          if (ishave == undefined) {
            //防止重复插入
            this[code] = true;
            this.$refs.xTable1.insert({ countitem: name, countcode: code }).then(({ row }) => {
              this.$refs.xTable1.setCurrentRow(row);
              this.currRowIndex = tablelist.length - 1;
            });
          }
        } else {
          this[code] = false;
          this.$alert("最多只能添加10条统计项目！", "提示", {
            confirmButtonText: "确定",
          });
        }
      } else {
        try {
          if (ishave != undefined) {
            this[code] = false;
            var alld = this.$refs.xTable1.tableData;
            var rowindex = alld.indexOf(ishave);
            this.$refs.xTable1.remove(ishave);
            let havedata = this.$refs.xTable1.tableData;
            if (havedata.length > 0) {
              if (rowindex >= havedata.length) rowindex = havedata.length - 1;
              let selectrow = havedata[rowindex];
              this.$refs.xTable1.setCurrentRow(selectrow);
              this.currRowIndex = rowindex;
            }
          }
        } catch (e) {
          console.log("error", e);
        }
      }
    },
    //展开查询列表
    btn_showselother() {
      this.is_showselother = !this.is_showselother;
      let mainheight = this.$refs.maindev.offsetHeight;
      if (this.is_showselother) {
        this.icon_showselother = "el-icon-caret-top";
        this.pagetopstyle.height = "170px";
        this.pagecenter.top = "174px";
        this.reportheight = mainheight - 315;
        if (this.is_ym) {
          this.ymresultheight = mainheight - 485;
        } else {
          this.resultheight = mainheight - 280;
        }
      } else {
        this.icon_showselother = "el-icon-caret-bottom";
        this.pagetopstyle.height = "105px";
        this.pagecenter.top = "109px";
        this.reportheight = mainheight - 159;
        if (this.is_ym) {
          this.ymresultheight = mainheight - 326;
        } else {
          this.resultheight = mainheight - 114;
        }
      }
    },
    dialogcountItemsave() {
      let data = this.$refs.xTable1.tableData;
      let res1 = "";
      let res2 = "";
      if (data.length > 0) {
        data.forEach((element) => {
          if (res2 == "") {
            res2 = element.countitem;
            res1 = element.countcode;
          } else {
            res2 += "," + element.countitem;
            res1 += "," + element.countcode;
          }
        });
      }
      this.infoitem = res2;
      this.infocode = res1;
      this.dialogcountItem = false;
    },
    currentChangeEvent1({ row, $rowIndex }) {
      this.currRowIndex = $rowIndex;
    },
    tabledataup() {
      if (this.currRowIndex > 0) {
        let upData = this.$refs.xTable1.tableData[this.currRowIndex - 1];
        let currentrow = this.$refs.xTable1.tableData[this.currRowIndex];
        this.$refs.xTable1.tableData.splice(this.currRowIndex - 1, 1);
        this.$refs.xTable1.tableData.splice(this.currRowIndex, 0, upData);
        this.currRowIndex = this.currRowIndex - 1;
        this.$nextTick(() => {
          this.$refs.xTable1.setCurrentRow(currentrow);
        });
      }
    },
    tabledatadown() {
      if (this.$refs.xTable1.tableData.length > 0) {
        if (this.currRowIndex !== this.$refs.xTable1.tableData.length - 1) {
          let downData = this.$refs.xTable1.tableData[this.currRowIndex + 1];
          let currentrow = this.$refs.xTable1.tableData[this.currRowIndex];
          this.$refs.xTable1.tableData.splice(this.currRowIndex + 1, 1);
          this.$refs.xTable1.tableData.splice(this.currRowIndex, 0, downData);
          this.currRowIndex = this.currRowIndex + 1;
          this.$nextTick(() => {
            this.$refs.xTable1.setCurrentRow(currentrow);
          });
        }
      }
    },
    tabledatalast() {
      if (this.$refs.xTable1.tableData.length > 0) {
        if (this.currRowIndex != this.$refs.xTable1.tableData.length - 1) {
          let lastData = this.$refs.xTable1.tableData[this.currRowIndex];
          this.$refs.xTable1.tableData.splice(this.currRowIndex, 1);
          this.$refs.xTable1.tableData.splice(this.$refs.xTable1.tableData.length, 0, lastData);
          this.currRowIndex = this.$refs.xTable1.tableData.length - 1;
          this.$nextTick(() => {
            this.$refs.xTable1.setCurrentRow(lastData);
          });
        }
      }
    },
    tabledatafirst() {
      if (this.currRowIndex > 0) {
        let firstData = this.$refs.xTable1.tableData[this.currRowIndex];
        this.$refs.xTable1.tableData.splice(this.currRowIndex, 1);
        this.$refs.xTable1.tableData.splice(0, 0, firstData);
        this.currRowIndex = 0;
        this.$nextTick(() => {
          this.$refs.xTable1.setCurrentRow(firstData);
        });
      }
    },
    handleCommand(name) {
      this.datename = name;
      if (name == "标本日期") {
        this.datecode = "sam";
      } else {
        this.datecode = "rpt";
      }
    },
    async initOption() {
      try {
        const res = await this.$tool.request({
          url: "LIS/LIS6/LIS610",
          method: "post",
          data: {
            action: "initOption",
          },
        });

        this.pattypeOption = res.pattypeOption;
        this.deptOption = res.deptOption;
        this.labdeptOption = res.labdeptOption;
        this.hospOption = res.hospOption;
        this.doctorOption = res.doctorOption;
        this.rptunitOption = res.rptunitOption;
        this.rptunitGroupOption = res.rptunitGroupOption;
        this.reportcommOption = res.reportcommOption;
        this.wardOption = res.wardOption;
        this.labgroupOption = res.labgroupOption;
        this.specimenOption = res.specimenOption;
        this.userOption = res.userOption;
        this.instrOption = res.instrOption;
        if (res.secHospCode && res.secHospCode != "") {
          this.pat_hospcode = res.secHospCode;
        }
      } catch (e) {
        this.$message.warning(e);
      }
    },
    BtnQuery() {
      this.InitPage();
    },
    BtnSort() {
      this.$rmsort(
        { tableColumn: this.SortTableColumn, sortArr: this.sortArr },
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then((res) => {
          this.sortArr = res.data;
          this.InitPage();
        })
        .catch(() => { });
    },
    BtnClear() {
      this.initdate();
      this.txtchkhospcode = " ";
      this.txtchkdeptno = " ";
      this.txtlabgroup = " ";
      this.txtchkdoctor = "";
      this.txtpattype = " ";
      this.txtemerflag = "0";
      this.txtrptunit = "";
      this.txtsendhospcode = " ";
      this.txtreqdeptno = " ";
      this.txtunitgroup = "";
      this.txtsenddoctor = "";
      this.txtpatsex = "";
      this.txtdelflag = "0";
      this.txtmemo = "";
      this.infoitem = ""; //"项目代码,项目名称"; //送检医院
      this.infocode = ""; //"chkitemcode,chkitemname"; //this.chksendhospcode
      this.txtrptitem = "";
      this.txtchkreason = "";
      this.txtdiagnose = "";
      this.txtdiagnoseicd = "";
      this.txtchargetype = "";
      this.timevalue1 = "00:00";
      this.timevalue2 = "23:59";
      this.txtwardno = "";
      this.sel_mixrpt = "0";
      this.chk_nopatname = "1";
      this.chk_noreqno = "0";
      this.chk_notprint = "0";
      this.chk_notverify = "1";
      this.chk_notchargeitem = "1";
      this.chk_deptinput = "0";
      this.chk_pricemorezero = "0";
      this.chk_nobarcode = "0";
      this.chk_sunday = "1";
      this.chk_saturday = "1";
      this.chk_holiday = "1";
      this.chk_workdays = "1";
      this.chk_personnum = "0";
      this.chk_reportnum = "0";
      this.chk_itemrechknum = "0";
      this.chk_notshowcount = "0";
      this.tableData = [];
      this.txtquerymod = "";
      this.sampleno = "";
      this.pat_hospcode = "";
      this.showsum2 = "0";
      this.showsum1 = "0";
    },
    BtnExport() {
      // let options = {
      //     filename: "LIS610 综合统计(按检验报告).csv",
      // };
      // this.$refs.xTable.exportCsv(options);
      //let data = this.getExportData(this.tableData);
      // let data = this.tableData;
      // let book = XLSX.utils.book_new();
      // let sheet = XLSX.utils.json_to_sheet(data, { skipHeader: true });
      // XLSX.utils.book_append_sheet(book, sheet);
      // let wbout = XLSX.write(book, { bookType: "xlsx", bookSST: false, type: "binary" });
      // let blob = new Blob([this.toBuffer(wbout)], { type: "application/octet-stream" });
      var columns = XEUtils.clone(this.tableColumn, true);
      columns.push({ field: "cp_cnt", title: "项次" });
      columns.push({ field: "cp_amt", title: "金额" });
      if (this.chk_personnum == "1") columns.push({ field: "cp_rs", title: "人数" });
      if (this.chk_reportnum == "1") columns.push({ field: "cp_samplecnt", title: "样本数" });
      if (this.chk_itemrechknum == "1") columns.push({ field: "cp_redocnt", title: "项目复查数" });

      let footerData = {};
      columns.forEach((item, index) => {
        if (index === 0) {
          footerData[item.field] = "总计";
        }
        let resdata = this.tableData.filter((x) => {
          return x.color != "1" && x.color != "2";
        });
        if (["cp_amt", "cp_cnt", "cp_rs", "cp_samplecnt"].includes(item.field)) {
          footerData[item.field] = XEUtils.sum(resdata, item.field).toFixed(2);
        }
      });
      let datas = XEUtils.clone(this.tableData, true);
      datas.push(footerData);
      let filtertxt = this.getExportFilter();
      this.$pub.exportTableExcel(datas, columns, "LIS610 综合统计(按检验报告).xlsx", filtertxt, "统计条件：");
      // 保存导出
      //FileSaver.saveAs(blob, "LIS610 综合统计(按检验报告).xlsx");
    },
    chkhospcodeChange(code, name) {
      this.txtchkhospcode = code;
      this.txtchkhospname = name;
    },
    chkdoctorChange(code, name) {
      this.txtchkdoctor = code;
      this.txtchkdoctorname = name;
    },
    senddoctorChange(code, name) {
      this.txtsenddoctor = code;
      this.txtsenddoctorname = name;
    },
    pathospitalChange(code, name) {
      this.pat_hospcode = code;
      this.pat_hospname = name;
    },
    chargetypeChange(code, name) {
      this.txtchargetype = code;
      this.txtchargetypename = name;
    },
    // 获取当前导出文件的所有统计条件
    getExportFilter() {
      // 日期
      let filtertxt = this.datename + ":" + XEUtils.toDateString(this.txtstartdate, "yyyy-MM-dd") + "至" + XEUtils.toDateString(this.txtenddate, "yyyy-MM-dd") + "; ";
      if (this.txtchkhospcode) filtertxt += "检验院区:" + this.txtchkhospname + "; ";
      if (this.txtchkdeptno) filtertxt += "检验科室:" + this.getOptionName(this.labdeptOption.filter((item) => ("," + this.txtchkdeptno + ",").indexOf("," + item.data + ",") > -1)) + ", ";
      if (this.txtlabgroup) filtertxt += "检验组别:" + this.getOptionName(this.labgroupOption.filter((item) => ("," + this.txtlabgroup + ",").indexOf("," + item.data + ",") > -1)) + ", ";
      if (this.txtchkdoctor) filtertxt += "检验医生:" + this.txtchkdoctorname + "; ";
      if (this.txtquerymod) filtertxt += "查询模板:" + this.getOptionName(this.querymodOption.filter((item) => ("," + this.txtquerymod + ",").indexOf("," + item.value + ",") > -1)) + "; ";
      if (this.txtrptunit) filtertxt += "报告单元:" + this.getOptionName(this.rptunitOption.filter((item) => ("," + this.txtrptunit + ",").indexOf("," + item.data + ",") > -1)) + "; ";
      if (this.txtsendhospcode) filtertxt += "送检医院:" + this.getOptionName(this.hospOption.filter((item) => ("," + this.txtsendhospcode + ",").indexOf("," + item.data + ",") > -1)) + "; ";
      if (this.txtreqdeptno) filtertxt += "申请科室:" + this.getOptionName(this.deptOption.filter((item) => ("," + this.txtreqdeptno + ",").indexOf("," + item.data + ",") > -1)) + "; ";
      if (this.txtwardno) filtertxt += "申请病区:" + this.getOptionName(this.wardOption.filter((item) => ("," + this.txtwardno + ",").indexOf("," + item.data + ",") > -1)) + "; ";
      if (this.txtsenddoctor) filtertxt += "申请医生:" + this.txtsenddoctorname + "; ";
      if (this.txtchkreason) filtertxt += "送检原因:" + this.txtchkreason + "; ";
      if (this.txtrptitem) filtertxt += "报告项目:" + this.txtrptitemname + "; ";
      if (this.txtpatsex) filtertxt += "病人性别:" + (this.txtpatsex == "1" ? "男" : "女") + "; ";
      if (this.txtemerflag == "1") filtertxt += "急诊" + "; ";
      if (this.txtpattype) filtertxt += "病人类型:" + this.getOptionName(this.pattypeOption.filter((item) => ("," + this.txtpattype + ",").indexOf("," + item.data + ",") > -1)) + "; ";
      if (this.txtdiagnose) filtertxt += "病人诊断:" + this.txtdiagnose + "; ";
      if (this.txtdiagnoseicd) filtertxt += "诊断ICD:" + this.txtdiagnoseicd + "; ";
      if (this.txtmemo) filtertxt += "医生备注:" + this.txtmemo + "; ";
      if (this.sampleno) filtertxt += "标本号区间:" + this.sampleno + "; ";
      if (this.pat_hospcode) filtertxt += "所属医院:" + this.pat_hospname + "; ";
      if (this.txtunitgroup) filtertxt += "单元组合:" + this.getOptionName(this.rptunitGroupOption.filter((item) => ("," + this.txtunitgroup + ",").indexOf("," + item.data + ",") > -1)) + "; ";
      if (this.txtchargetype) filtertxt += "费别大类:" + this.txtchargetypename + "; ";
      if (this.timevalue1) filtertxt += (this.txtdelflag == "1" ? "剔除" : "") + "时间段:" + this.timevalue1 + "至" + this.timevalue2 + "; ";
      if (this.infoitem) filtertxt += "统计项目:" + this.infoitem + "; ";
      if (this.sel_mixrpt) filtertxt += "混样报告:" + (this.sel_mixrpt == "0" ? "全部报告" : this.sel_mixrpt == "1" ? "混样主报告" : "混样明细报告") + "; ";
      let notattxt = "";
      if (this.chk_nopatname == "1") notattxt += "无病人姓名、"
      if (this.chk_noreqno == "1") notattxt += "无申请号、";
      if (this.chk_notprint == "1") notattxt += "未打印、";
      if (this.chk_notverify == "1") notattxt += "未审核、"
      if (this.chk_notchargeitem == "1") notattxt += "非计价项目、";
      if (this.chk_deptinput == "1") notattxt += "科内录入、";
      if (notattxt) filtertxt += notattxt.substring(0, notattxt.length - 1) + "的标本不统计;";
      let daytxt = "";
      if (this.chk_workdays == "1") daytxt += "工作日、"
      if (this.chk_holiday == "1") daytxt += "节假日、";
      if (this.chk_saturday == "1") daytxt += "周六、";
      if (this.chk_sunday == "1") daytxt += "周日、"
      if (daytxt) filtertxt += "统计包含" + daytxt.substring(0, daytxt.length - 1) + "; ";
      if (this.chk_nobarcode == "1") filtertxt += "仅统计无条码;"
      if (this.chk_pricemorezero == "1") filtertxt += "仅显示项目价格大于0;"
      if (this.showsum2 == "1") filtertxt += "显示小计;"
      if (this.showsum1 == "1") filtertxt += "显示合计;"
      return filtertxt;
    },
    getOptionName(option) {
      if (option && option.length > 0) {
        let optionname = "";
        option.forEach((item) => {
          if (item.hasOwnProperty("display")) {
            optionname += item.display + ",";
          } else {
            optionname += item.label + ",";
          }
        });
        return optionname.substring(0, optionname.length - 1);
      } else {
        return "";
      }
    },
    getExportData(savedatas) {
      let columns = this.$refs.xTable.getColumns();
      let footerData = {};
      this.exportTableColumn = [];
      columns.forEach((item, index) => {
        this.exportTableColumn.push({ title: item.title, field: item.property });
        if (index === 0) {
          footerData[item.property] = "总计";
        }
        let resdata = this.tableData.filter((x) => {
          return x.color != "1" && x.color != "2";
        });

        if (["cp_amt", "cp_cnt", "cp_rs", "cp_samplecnt", "cp_redocnt"].includes(item.property)) {
          footerData[item.property] = XEUtils.sum(resdata, item.property).toFixed(2);
        }
      });

      let datas = XEUtils.clone(savedatas, true);
      datas.splice(datas.length, 0, footerData);
      columns = this.exportTableColumn.filter((item) => item.field);
      let headers = [columns.map((item) => item.title)];
      return headers.concat(
        datas.map((row) => {
          return columns.map((column) => {
            return this.commFormatFun(row[column.field], column.field);
          });
        })
      );
    },
    toBuffer(wbout) {
      let buf = new ArrayBuffer(wbout.length);
      let view = new Uint8Array(buf);
      for (let index = 0; index !== wbout.length; ++index) view[index] = wbout.charCodeAt(index) & 0xff;
      return buf;
    },
    BtnPrint(btype) {
      let qwhere = "日期:" + XEUtils.toDateString(this.txtstartdate, "yyyy-MM-dd") + " - " + XEUtils.toDateString(this.txtenddate, "yyyy-MM-dd");
      let qcol = this.infoitem;
      console.log("qwhere", qwhere);
      console.log("qcol", qcol);

      let footerData = {};
      let columns = this.$refs.xTable.getColumns();
      columns.forEach((item, index) => {
        if (index === 0) {
          footerData[item.property] = "总计";
        }
        let resdata = this.tableData.filter((x) => {
          return x.color != "1" && x.color != "2";
        });

        if (["cp_amt", "cp_cnt", "cp_rs", "cp_samplecnt", "cp_redocnt"].includes(item.property)) {
          footerData[item.property] = XEUtils.sum(resdata, item.property).toFixed(2);
        } else if (index > 0) {
          footerData[item.property] = "";
        }
      });
      let datas = XEUtils.clone(this.tableData, true);
      datas.push(footerData);
      this.$pub.PrintDynamicCol(this, "5079", datas, this.$refs.xTable.getTableColumn().tableColumn, qwhere, qcol, btype);
    },
    InitPage() {
      if (this.infoitem == "") {
        this.$alert("点击查询条件中统计项目(红字标识)，先选择统计项目后再查询！", "信息");
        return false;
      }

      this.xTableLoading = true;
      this.$tool
        .request({
          url: "LIS/LIS6/LIS610",
          method: "post",
          timeout: 600000,
          data: {
            action: "InitPage",
            txtstartdate: this.txtstartdate, //标本开始日期
            txtenddate: this.txtenddate, //标本结束日期
            txtchkhospcode: this.txtchkhospcode, //检验院区
            txtchkdeptno: this.txtchkdeptno, //检验科室
            txtlabgroup: this.txtlabgroup, //检验组别
            txtchkdoctor: this.txtchkdoctor, //检验医生
            txtpattype: this.txtpattype, //病人类型
            txtemerflag: this.txtemerflag, //急诊
            txtrptunit: this.txtrptunit, //报告单元
            txtsendhospcode: this.txtsendhospcode, //送检医院
            txtreqdeptno: this.txtreqdeptno, //申请科室
            txtunitgroup: this.txtunitgroup, //单元组合
            txtsenddoctor: this.txtsenddoctor, //送检医生
            txtpatsex: this.txtpatsex, //病人姓名
            txtdelflag: this.txtdelflag, //剔除
            txtmemo: this.txtmemo, //备注
            infoitem: this.infoitem, //统计项目
            txtrptitem: this.txtrptitem, //报告项目
            txtchkreason: this.txtchkreason, //送检原因
            txtdiagnose: this.txtdiagnose, //诊断
            txtdiagnoseicd: this.txtdiagnoseicd, //诊断ICD
            txtchargetype: this.txtchargetype, //费别大类
            timespan1: this.timevalue1, //时间段
            timespan2: this.timevalue2, //时间段
            txtwardno: this.txtwardno, //病区
            pat_hospcode: this.pat_hospcode, //病人所属医院
            chk_notprint: this.chk_notprint, //未打印
            chk_notverify: this.chk_notverify, //未审核
            chk_notchargeitem: this.chk_notchargeitem, //非计价项目
            chk_deptinput: this.chk_deptinput, // 科内录入
            chk_nopatname: this.chk_nopatname, //无病人姓名
            sel_mixrpt: this.sel_mixrpt, //混样报告
            chk_pricemorezero: this.chk_pricemorezero, //仅显示项目价格大于0
            chk_nobarcode: this.chk_nobarcode, //仅统计无条码
            chk_noreqno: this.chk_noreqno, //无申请号
            chk_sunday: this.chk_sunday, //周日
            chk_saturday: this.chk_saturday, //周六
            chk_holiday: this.chk_holiday, //节假日
            chk_workdays: this.chk_workdays, //工作日
            chk_personnum: this.chk_personnum, //人数
            chk_reportnum: this.chk_reportnum, //报告数
            chk_itemrechknum: this.chk_itemrechknum, //项目复查数
            chk_notshowcount: this.chk_notshowcount, //不显示小计
            datecode: this.datecode, //标本日期(sam)OR报告日期(rpt)
            sampleno: this.sampleno, //  添加标本号区间上限
            showsum2: this.showsum2, // 是否显示小计
            showsum1: this.showsum1, //  是否显示合计
            infocode: this.infocode, //要查询的列数
            sortArr: this.sortArr, //排序
          },
        })
        .then((response) => {
          if (!!response.RData.Data) {
            ++this.xTablekey;
            this.tableColumn = response.RData.Cols;
            this.tableData = [];
            var temparr = [];
            for (let i = 0; i < response.RData.Data.length; i++) {
              var row = response.RData.Data[i];
              for (var pkey in row) {
                if (["cp_amt", "cp_cnt", "cp_rs", "cp_samplecnt", "cp_redocnt"].includes(pkey)) continue;
                row[pkey] = this.commFormatFun(row[pkey], pkey);
                // if (i == 0) {
                //     temparr.push({ field: pkey, label: row[pkey] });
                //     break;
                // }
                // var findrow = temparr.find(item => item.field == pkey);
                // if (findrow && findrow.label == row[pkey]) row[pkey] = "";
                // else if (findrow) findrow.label = row[pkey];
              }

              this.tableData.push(row);
            }

            //this.tableData = this.getExportData(response.RData.Data);

            this.xTableLoading = false;
          } else {
            // this.InitPage();
            this.$message.warning("查询超时,可以尝试缩短查询日期或减少分组条件！");
            this.xTableLoading = false;
          }
        })
        .catch((e) => {
          this.$alert(e, "信息");
        });
    },
    //查询模版选择
    querymodChange(value) {
      if (value) {
        let modList = localStorage.getItem("rm_Qmod_LIS610");
        let tempOption = JSON.parse(modList);
        this.querymodOption = tempOption;
        let obj = localStorage.getItem("rm_Qmod_LIS610_" + value);
        let jsondata = JSON.parse(obj);
        this.txtchkhospcode = jsondata.txtchkhospcode;
        this.txtchkdeptno = jsondata.txtchkdeptno;
        this.txtlabgroup = jsondata.txtlabgroup;
        this.txtchkdoctor = jsondata.txtchkdoctor;
        this.txtpattype = jsondata.txtpattype;
        this.txtemerflag = jsondata.txtemerflag;
        this.txtrptunit = jsondata.txtrptunit;
        this.txtsendhospcode = jsondata.txtsendhospcode;
        this.txtreqdeptno = jsondata.txtreqdeptno;
        this.txtunitgroup = jsondata.txtunitgroup;
        this.txtsenddoctor = jsondata.txtsenddoctor;
        this.txtpatsex = jsondata.txtpatsex;
        this.txtdelflag = jsondata.txtdelflag;
        this.txtmemo = jsondata.txtmemo;
        this.txtrptitem = jsondata.txtrptitem;
        this.txtchkreason = jsondata.txtchkreason;
        this.txtdiagnose = jsondata.txtdiagnose;
        this.txtdiagnoseicd = jsondata.txtdiagnoseicd;
        this.txtchargetype = jsondata.txtchargetype;
        this.timevalue1 = jsondata.timevalue1;
        this.timevalue2 = jsondata.timevalue2;
        this.chk_nopatname = jsondata.chk_nopatname;
        this.sel_mixrpt = jsondata.sel_mixrpt;
        this.chk_noreqno = jsondata.chk_noreqno;
        this.chk_notprint = jsondata.chk_notprint;
        this.chk_notverify = jsondata.chk_notverify;
        this.chk_notchargeitem = jsondata.chk_notchargeitem;
        this.chk_pricemorezero = jsondata.chk_pricemorezero;
        this.chk_nobarcode = jsondata.chk_nobarcode;
        this.txtchkhospname = jsondata.txtchkhospname;
        this.txtchkdoctorname = jsondata.txtchkdoctorname;
        this.txtsenddoctorname = jsondata.txtsenddoctorname;
        this.pat_hospname = jsondata.pat_hospname;
        this.txtchargetypename = jsondata.txtchargetypename;
        this.txtrptitemname = jsondata.txtrptitemname;
        this.txtwardno = jsondata.txtwardno;
        this.sampleno = jsondata.sampleno;
        this.pat_hospcode = jsondata.pat_hospcode;
        this.chk_deptinput = jsondata.chk_deptinput;
        this.showsum2 = jsondata.showsum2;
        this.showsum1 = jsondata.showsum1;
        this.infocode = jsondata.infocode;
        this.infoitem = jsondata.infoitem;
      }
    },
    //查询模版保存
    btnSavequerymod() {
      let jsondata = {
        txtchkhospcode: this.txtchkhospcode,
        txtchkdeptno: this.txtchkdeptno,
        txtlabgroup: this.txtlabgroup,
        txtchkdoctor: this.txtchkdoctor,
        txtpattype: this.txtpattype,
        txtemerflag: this.txtemerflag,
        txtrptunit: this.txtrptunit,
        txtsendhospcode: this.txtsendhospcode,
        txtreqdeptno: this.txtreqdeptno,
        txtunitgroup: this.txtunitgroup,
        txtsenddoctor: this.txtsenddoctor,
        txtpatsex: this.txtpatsex,
        txtdelflag: this.txtdelflag,
        txtmemo: this.txtmemo,
        txtrptitem: this.txtrptitem,
        txtchkreason: this.txtchkreason,
        txtdiagnose: this.txtdiagnose,
        txtdiagnoseicd: this.txtdiagnoseicd,
        txtchargetype: this.txtchargetype,
        timevalue1: this.timevalue1,
        timevalue2: this.timevalue2,
        sel_mixrpt: this.sel_mixrpt,
        chk_nopatname: this.chk_nopatname,
        chk_noreqno: this.chk_noreqno,
        chk_notprint: this.chk_notprint,
        chk_notverify: this.chk_notverify,
        chk_notchargeitem: this.chk_notchargeitem,
        chk_pricemorezero: this.chk_pricemorezero,
        chk_nobarcode: this.chk_nobarcode,
        txtchkhospname: this.txtchkhospname,
        txtchkdoctorname: this.txtchkdoctorname,
        txtsenddoctorname: this.txtsenddoctorname,
        pat_hospname: this.pat_hospname,
        txtchargetypename: this.txtchargetypename,
        txtrptitemname: this.txtrptitemname,
        txtwardno: this.txtwardno,
        sampleno: this.sampleno,
        pat_hospcode: this.pat_hospcode,
        chk_deptinput: this.chk_deptinput,
        showsum2: this.showsum2,
        showsum1: this.showsum1,
        infocode: this.infocode,
        infoitem: this.infoitem,
      };
      this.$prompt("查询模版保存名称", "文字编辑", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        // inputPattern: /^\s*$/g,
        // inputErrorMessage: "模版名称格式不正确"
      })
        .then(({ value }) => {
          if (value && value.trim() != "") {
            this.querymodOption = [];
            let modOption = localStorage.getItem("rm_Qmod_LIS610");
            let modOptions = JSON.parse(modOption);
            let item = undefined;
            if (modOptions != null) {
              this.querymodOption = XEUtils.clone(modOptions, true);
              item = modOptions.find((m) => m.value == value);
            }
            if (item != undefined) {
            } else {
              this.querymodOption.push({ label: value, value: value });
            }
            let modListJson = JSON.stringify(jsondata);
            let modList = JSON.stringify(this.querymodOption);
            localStorage.setItem("rm_Qmod_LIS610_" + value, modListJson);
            localStorage.setItem("rm_Qmod_LIS610", modList);
            this.txtquerymod = value;
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "取消输入",
          });
        });
    },
    //查询模版删除
    btnDelquerymod() {
      this.$confirm("您确定删除查询模版：" + this.txtquerymod + "吗？", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let value = this.txtquerymod;
          localStorage.removeItem("rm_Qmod_LIS610_" + value);
          let modList = localStorage.getItem("rm_Qmod_LIS610");
          let jsondata = JSON.parse(modList);
          this.querymodOption = [];
          jsondata.forEach((item) => {
            if (item.value == value) {
            } else {
              this.querymodOption.push(item);
            }
          });
          let newmodList = JSON.stringify(this.querymodOption);
          localStorage.setItem("rm_Qmod_LIS610", newmodList);
          this.txtquerymod = "";
        })
        .catch(() => { });
    },
    //统计模版保存
    btnSaveStaticmod() {
      let jsondata = {
        chk_personnum: this.chk_personnum,
        chk_reportnum: this.chk_reportnum,
        chk_itemrechknum: this.chk_itemrechknum,
        tabledata: this.$refs.xTable1.tableData,
      };
      this.$prompt("统计模版保存名称", "文字编辑", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        // inputPattern: /^\s*$/g,
        // inputErrorMessage: "模版名称格式不正确"
      })
        .then(({ value }) => {
          if (value && value.trim() != "") {
            this.stasticsmodOption = [];
            let modOption = localStorage.getItem("rm_Smod_LIS610");
            let modOptions = JSON.parse(modOption);
            let item = undefined;
            if (modOptions != null) {
              this.stasticsmodOption = XEUtils.clone(modOptions, true);
              item = modOptions.find((m) => m.value == value);
            }
            if (item != undefined) {
            } else {
              this.stasticsmodOption.push({ label: value, value: value });
            }
            let modListJson = JSON.stringify(jsondata);
            let modList = JSON.stringify(this.stasticsmodOption);
            localStorage.setItem("rm_Smod_LIS610_" + value, modListJson);
            localStorage.setItem("rm_Smod_LIS610", modList);
            this.txtstasticsmod = value;
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "取消输入",
          });
        });
    },
    //统计模版删除
    btnDelStaticmod() {
      this.$confirm("您确定删除查询模版：" + this.txtstasticsmod + "吗？", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let value = this.txtstasticsmod;
          localStorage.removeItem("rm_Smod_LIS610_" + value);
          let modList = localStorage.getItem("rm_Smod_LIS610");
          let jsondata = JSON.parse(modList);
          this.stasticsmodOption = [];
          jsondata.forEach((item) => {
            if (item.value == value) {
            } else {
              this.stasticsmodOption.push(item);
            }
          });
          let newmodList = JSON.stringify(this.stasticsmodOption);
          localStorage.setItem("rm_Smod_LIS610", newmodList);
          this.txtstasticsmod = "";
        })
        .catch(() => { });
    },
    //统计模版选择
    stasticmodChange(value) {
      this.resetStasticItem();
      let modList = localStorage.getItem("rm_Smod_LIS610");
      let tempOption = JSON.parse(modList);
      this.stasticsmodOption = tempOption;
      let obj = localStorage.getItem("rm_Smod_LIS610_" + value);
      let jsondata = JSON.parse(obj);
      this.$nextTick(() => {
        this.chk_personnum = jsondata.chk_personnum;
        this.chk_reportnum = jsondata.chk_reportnum;
        this.chk_itemrechknum = jsondata.chk_itemrechknum;
        this.$refs.xTable1.tableData = jsondata.tabledata;
        setTimeout(() => {
          let data = this.$refs.xTable1.tableData;
          if (data.length != 0) {
            this.currRowIndex = 0;
            this.$refs.xTable1.setCurrentRow(data[0]);
          }
        }, 10);
        jsondata.tabledata.forEach((item) => {
          this[item.countcode] = true;
        });
      });
    },
    formatFun({ cellValue, column }) {
      return this.commFormatFun(cellValue, column.property);
    },
    commFormatFun(cellValue, column) {
      if (["hospitalcode", "pat_hospcode"].includes(column)) {
        try {
          if (cellValue.toLowerCase() == "all") {
            return "全部医院";
          } else {
            let hospname = this.hospOption.find((m) => m.data == cellValue);
            if (hospname != undefined && hospname != null) {
              return hospname.display;
            } else {
              return cellValue;
            }
          }
        } catch { }
      } else if (["req_deptno", "labdeptcode"].includes(column)) {
        try {
          let deptname = this.deptOption.find((m) => m.data == cellValue);
          if (deptname != undefined && deptname != null) {
            return deptname.display;
          } else {
            return cellValue;
          }
        } catch { }
      } else if (column == "pat_typecode") {
        try {
          let pattypename = this.pattypeOption.find((m) => m.data == cellValue);
          if (pattypename != undefined && pattypename != null) {
            return pattypename.display;
          } else {
            return cellValue;
          }
        } catch { }
      } else if (["req_docno"].includes(column)) {
        //申请医生
        try {
          let doctorname = this.doctorOption.find((m) => m.data == cellValue);
          if (doctorname != undefined && doctorname != null) {
            return doctorname.display;
          } else {
            return cellValue;
          }
        } catch { }
      } else if (["req_wardno"].includes(column)) {
        //申请病区
        try {
          let wardname = this.wardOption.find((m) => m.data == cellValue);
          if (wardname != undefined && wardname != null) {
            return wardname.display;
          } else {
            return cellValue;
          }
        } catch { }
      } else if (["rechk_user", "report_user", "sampled_user"].includes(column)) {
        //检验医生，审核医生
        try {
          let username = this.userOption.find((m) => m.data == cellValue);
          if (username != undefined && username != null) {
            return username.display;
          } else {
            return cellValue;
          }
        } catch { }
      } else if (column == "rptunitid") {
        try {
          let rptunitname = this.rptunitOption.find((m) => m.data - 0 == cellValue - 0);
          if (rptunitname != undefined && rptunitname != null) {
            return rptunitname.display;
          } else {
            return cellValue;
          }
        } catch { }
      } else if (column == "specimen_code") {
        try {
          let specimenname = this.specimenOption.find((m) => m.data == cellValue);
          if (specimenname != undefined && specimenname != null) {
            return specimenname.display;
          } else {
            return cellValue;
          }
        } catch {
          return cellValue;
        }
      } else if (column == "pat_sex") {
        if (cellValue == "1") {
          return "男";
        } else if (cellValue == "2") {
          return "女";
        } else {
          return "";
        }
      } else if (column == "charge_flag") {
        try {
          let rptunitname = this.chargeflagOption.find((m) => m.value == cellValue);
          if (rptunitname != undefined && rptunitname != null) {
            return rptunitname.label;
          } else {
            return cellValue;
          }
        } catch { }
      } else if (column == "instrid") {
        try {
          let instr = this.instrOption.find((m) => m.data == cellValue);
          if (instr != undefined && instr != null) {
            return instr.display;
          } else {
            return cellValue;
          }
        } catch {
          return cellValue;
        }
      } else {
        return cellValue;
      }
    },
    footerCellClassName({ $rowIndex, column, columnIndex }) {
      if (columnIndex === 0 || ["cp_cnt", "cp_amt", "cp_rs", "cp_samplecnt", "cp_redocnt"].includes(column.property)) {
        if ($rowIndex === 0) {
          return "col-blue";
        } else {
          return "col-red";
        }
      }
    },
    CellClassName({ row, rowIndex, column, columnIndex }) {
      if (row.color == "1") return "col-green";
      if (row.color == "2") return "col-brown";
    },
    querySearch(queryString, cb) {
      var restaurants = this.reportcommOption;
      var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    createFilter(queryString) {
      return (restaurant) => {
        return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0;
      };
    },
    handleSelect(item) {
      this.txtmemo = item.value;
    },
    footerMethod({ columns, data }) {
      return this.computeFooterethod(columns, data);
    },
    computeFooterethod(columns, data) {
      return [
        columns.map((column, columnIndex) => {
          if (columnIndex === 0) {
            return "总计";
          }

          let resdata = data.filter((x) => {
            return x.color != "1" && x.color != "2";
          });
          if (["cp_amt", "cp_cnt", "cp_rs", "cp_samplecnt", "cp_redocnt"].includes(column.property)) {
            return XEUtils.sum(resdata, column.property).toFixed(2);
          }
          return null;
        }),
      ];
    },
    // tableClear() {
    //     this.chksendhospcode = false;
    //     this.chksenddeptno = false;
    //     this.chksenddoctor = false;
    //     this.chksendreason = false;
    //     this.chkexamdoctor = false;
    //     this.chkexamhospcode = false;
    //     this.chkverifydoctor = false;
    //     this.chkexamdeptno = false;
    //     this.chkexamgroup = false;
    //     this.chkexamtptunit = false;
    //     this.chkexaminstrument = false;
    //     this.chkexammemo = false;
    //     this.chkpatwardno = false;
    //     this.chkpatname = false;
    //     this.chkpatdianose = false;
    //     this.chkpatdianoseicd = false;
    //     this.chkpatsex = false;
    //     this.chkpattype = false;
    //     this.chkpatchargetype = false;
    //     this.chkpatchargeno = false;
    //     this.chkpatnation = false;
    //     this.chkitemspecimen = false;
    //     this.chkitemchargeflag = false;
    //     this.chkitemcode = false;
    //     this.chkitemname = false;
    //     this.chkitemprice = false;
    //     this.chkitemstatisticcode = false;
    //     this.chkdateyear = false;
    //     this.chkdatemonth = false;
    //     this.chkdateday = false;
    //     this.chkpatOfhospcode = false;
    //     this.staticitemData = [];
    // },
    xTable1dblclick({ row, column }) {
      this[row.countcode] = false;
      try {
        var delrow = this.$refs.xTable1.getCurrentRow();
        if (delrow) {
          var alld = this.$refs.xTable1.tableData;
          var rowindex = alld.indexOf(delrow);
          this.$refs.xTable1.remove(delrow);
          let havedata = this.$refs.xTable1.tableData;
          if (havedata.length > 0) {
            if (rowindex >= havedata.length) rowindex = havedata.length - 1;
            let selectrow = havedata[rowindex];
            this.$refs.xTable1.setCurrentRow(selectrow);
          }
        }
      } catch (e) {
        console.log("error", e);
      }
    },
  },
};
</script>

<style scoped>
.pagetop {
  width: 100%;
  display: -webkit-box;
  -webkit-box-pack: center;
  -webkit-box-align: center;
  border: solid 1px #ccc;
  position: absolute;
  z-index: 99;
  height: 215px;
  overflow-x: auto;
  overflow-x: overlay;
}

.pagecenter {
  position: absolute;
  top: 220px;
  width: 100%;
  left: 0;
  bottom: 0px;
  overflow: auto;
}

.middle-center {
  position: absolute;
  height: 100%;
  left: 0px;
  right: 0px;
  overflow: auto;
}

.el-checkbox__label {
  padding: 0px;
}

.left_nav {
  width: 20%;
  height: 100%;
  border-right: 1px solid #ccc;
  padding: 0px 0px 0px 0px;
  float: left;
  display: inline;
}

.left_nav div {
  cursor: pointer;
  height: 40px;
  width: 100%;
  float: left;
  padding-left: 20px;
  line-height: 40px;
}

.left_nav .active {
  background-color: DeepSkyBlue;
}

.right_nav {
  width: 80%;
  height: 100%;
  display: inline-block;
  vertical-align: top;
  float: left;
  display: inline;
}

table {
  font-size: 12px;
  border-collapse: separate;
  border-spacing: 5px;
}

.table1style tr td {
  padding: 0px 2px 0px 5px;
}

::v-deep .mytable-style .vxe-body--column.col-green {
  color: green !important;
  font-weight: bold;
}

::v-deep .mytable-style .vxe-body--column.col-brown {
  color: brown !important;
  font-weight: bold;
}

::v-deep .mytable-style .vxe-footer--column.col-blue {
  color: blue !important;
  font-weight: bold;
}

::v-deep .mytable-style .vxe-body--row.row-blue {
  color: blue !important;
  font-weight: bold;
}

::v-deep .el-checkbox__label {
  padding-left: 0px;
}

::v-deep .el-icon-time {
  line-height: 18px !important;
}

::v-deep .el-range__close-icon {
  line-height: 18px !important;
}

::v-deep .el-range-editor--small .el-range-separator {
  line-height: 17px !important;
}

::v-deep .mychkclass .el-checkbox {
  margin-right: 15px;
}

.operation-list {
  float: right;
  margin-right: 5px;
  margin-bottom: 5px;
}

::-webkit-scrollbar {
  width: 0px;
  height: 5px;
  border: 4px solid white;
}

::-webkit-scrollbar-thumb {
  background-color: #c1c1c1;
}

::-webkit-scrollbar-track {
  background-color: #f1f1f1;
}

/* Buttons */
::-webkit-scrollbar-button:single-button {
  background-color: #bbbbbb;
  display: block;
  border-style: solid;
  height: 5px;
  width: 5px;
}

/* Left */
::-webkit-scrollbar-button:horizontal:decrement {
  margin-right: 2px;
  border-width: 4px 4px 4px 0;
  border-color: #f1f1f1 transparent #f1f1f1 #f1f1f1;
  background-color: #000000;
}

::-webkit-scrollbar-button:horizontal:decrement:hover {
  border-color: #d2d2d2 transparent #d2d2d2 #d2d2d2;
}

/* Right */
::-webkit-scrollbar-button:horizontal:increment {
  margin-left: 2px;
  border-width: 4px 0 4px 4px;
  border-color: #f1f1f1 #f1f1f1 #f1f1f1 transparent;
  background-color: #000000;
}

::-webkit-scrollbar-button:horizontal:increment:hover {
  border-color: #d2d2d2 #d2d2d2 #d2d2d2 transparent;
}

::v-deep.el-input--suffix .el-input__inner {
  padding-right: 0px;
}</style>
